<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>修改页面</h1>
    <input type="text"readonly v-model="emp.id">
    <input type="text" v-model="emp.name">
    <input type="text" v-model="emp.salary">
    <input type="text" v-model="emp.job">
    <input type="button" value="修改" @click="update()">
</div>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    let v= new Vue({
        el:"body>div",
        data:{
            emp:{
                id:"",name:"",salary:"",job:""
            }
        },
        created:function (){
            //location.search得到的就是地址兰中?以后的参数
            axios.get("/selectById"+location.search).then(function (response){
                v.emp = response.data;
            })
        },
        methods: {
            update(){
                axios.post("/update",v.emp).then(function (){
                    alert("修改成功");
                    location.href="/select.html";
                })
            }
        }
    })
</script>
</body>
</html>